package com.dtw.ditouwang.models;

import android.databinding.BindingAdapter;
import android.text.TextUtils;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

public class GlideImageLoader {
    @BindingAdapter({"imageUrl"})
    public static void loadImage(ImageView view, String url) {
        if(!TextUtils.isEmpty(url)) {
            if(url.contains("storage")){
                Glide.with(view.getContext()).load(url).into(view);
            }else {
                Glide.with(view.getContext()).load(WebApi.BaseUrl + url.replace("\\", "/")).into(view);
            }
        }
    }
}